﻿using System;
using System.Data;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnyOffice.Components;
using AnyOffice.DAL;
using AnyOffice.Model;

namespace AnyOffice.general.address.personal
{
    public partial class group_new : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page.IsPostBack)
            {
                this.pnlMain.Visible = false;
                AddressGroupDao dao = new AddressGroupDao();
                AddressGroupData data = new AddressGroupData();
                data.GroupName = this.txtGroupName.Text;
                data.UserId = base.User.Identity.Name;
                dao.Insert(base.Conn, data);
                this.litMessage.Text = base.ShowPrompt("分组新建成功！", "group.aspx");
                StringBuilder builder = new StringBuilder("<script>\n");
                builder.Append("parent.menu.location.reload();\n");
                builder.Append("parent.main.location='group.aspx';\n");
                builder.Append("</script>\n");
                if (!this.Page.IsClientScriptBlockRegistered("AddressGroup_list"))
                {
                    this.Page.RegisterClientScriptBlock("AddressGroup_list", builder.ToString());
                }
            }
        }

    }
}
